//获取应用实例
const app = getApp()
Page({
  data: {
    facilityList:[],
    id:1,
    code:'false',
    currentTap: 0,
    workorder:'001',
    color:'red',
    color2:'green',
    state_co:'未修复',
    state_co2:'已修复',
    problemdesc:'喷墨打印机，卡纸不打印，请尽快解决方便区域使用',
    equipmentmodel:'ADJASHFUUGASHIU',
    stallationaddress:'成都市锦江区人民广场土司大厦10楼',
    reportdate:'2020/03/23  20:13:34',
    // 组件所需的参数
    nvabarData: {
      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
      title: '报修记录', //导航栏 中间的标题
    },
    // 此页面 页面内容距最顶部的距离
    height: app.globalData.height * 2 + 20,
  },
  onLoad() {
    let that = this;
    let url = app.globalData.URL+'facility/facilityRepairs/user/list';
        let data = {};
        app.wxRequest('GET', url, data, (res) => {
          let facilityList = res.rows
          that.setData({
            facilityList:facilityList
          })
          console.log(facilityList)
        }, (err) => {
          console.log(err.errMsg)
        })
  },
  
  order_status: function (e) {
    var current = e.currentTarget.dataset.current
    this.setData({
      currentTap: current
    })
    let that = this;
    if(current ==0 ){
      let url = app.globalData.URL+'facility/facilityRepairs/user/list';
      let data = {};
      app.wxRequest('GET', url, data, (res) => {
        let facilityList = res.rows
        that.setData({
          facilityList:facilityList
        })
        console.log(facilityList)
      }, (err) => {
        console.log(err.errMsg)
      })
    }else if(current==1){
      let url = app.globalData.URL+'facility/facilityRepairs/user/list/?isSolve=false';
      let data = {};
      app.wxRequest('GET', url, data, (res) => {
        let facilityList = res.rows
        that.setData({
          facilityList:facilityList
        })
        console.log(facilityList)
      }, (err) => {
        console.log(err.errMsg)
      })
    }else if(current==2){
      let url = app.globalData.URL+'facility/facilityRepairs/user/list/?isSolve=true';
      let data = {};
      app.wxRequest('GET', url, data, (res) => {
        let facilityList = res.rows
        that.setData({
          facilityList:facilityList
        })
        console.log(facilityList)
      }, (err) => {
        console.log(err.errMsg)
      })
    }
  },
})
